<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="bolum" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{bolumHome.managed ? 'Edit' : 'Add'} Bolum</f:facet>


            <s:decorate id="idField" template="layout/edit.xhtml">
                <ui:define name="label">Id</ui:define>
                <h:inputText id="id"
                       required="true"
                          value="#{bolumHome.instance.id}"
                           size="26">
                    <a:support event="onblur" reRender="idField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>




            <s:decorate id="bolumAdiField" template="layout/edit.xhtml">
                <ui:define name="label">Bolum adi</ui:define>
                <h:inputText id="bolumAdi"
                       required="true"
                           size="50"
                      maxlength="50"
                          value="#{bolumHome.instance.bolumAdi}">
                    <a:support event="onblur" reRender="bolumAdiField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="bolumKoduField" template="layout/edit.xhtml">
                <ui:define name="label">Bolum kodu</ui:define>
                <h:inputText id="bolumKodu"
                       required="true"
                           size="5"
                      maxlength="5"
                          value="#{bolumHome.instance.bolumKodu}">
                    <a:support event="onblur" reRender="bolumKoduField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{bolumHome.persist}"
                       disabled="#{!bolumHome.wired}"
                       rendered="#{!bolumHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{bolumHome.update}"
                       rendered="#{bolumHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{bolumHome.remove}"
                      immediate="true"
                       rendered="#{bolumHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Bolum.xhtml"
                rendered="#{bolumHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty bolumFrom ? 'BolumList' : bolumFrom}.xhtml"
                rendered="#{!bolumHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Sektor">
    <div class="association" id="sektorParent">

        <h:outputText value="There is no sektor associated with this bolum."
                   rendered="#{bolumHome.instance.sektor == null}"/>

        <rich:dataTable var="_sektor"
                   value="#{bolumHome.instance.sektor}"
                rendered="#{bolumHome.instance.sektor != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="sektorTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_sektor.id}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Sektor adi</f:facet>
                <h:outputText value="#{_sektor.sektorAdi}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Sektor kodu</f:facet>
                <h:outputText value="#{_sektor.sektorKodu}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{bolumHome.instance.sektor != null ? 'changeParent' : 'selectParent'}" value="#{bolumHome.instance.sektor != null ? 'Change' : 'Select'} sektor"
                       view="/SektorList.xhtml">
                <f:param name="from" value="BolumEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Kullanici is tecrubeleris">
        <h:form styleClass="association" id="kullaniciIsTecrubelerisChildren">

            <h:outputText value="There are no kullaniciIsTecrubeleris associated with this bolum."
                       rendered="#{empty bolumHome.kullaniciIsTecrubeleris}"/>

            <rich:dataTable value="#{bolumHome.kullaniciIsTecrubeleris}"
                           var="_kullaniciIsTecrubeleri"
                      rendered="#{not empty bolumHome.kullaniciIsTecrubeleris}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="kullaniciIsTecrubelerisTable">
                <rich:column sortBy="#{_kullaniciIsTecrubeleri.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_kullaniciIsTecrubeleri.id}">
                        <f:convertNumber/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_kullaniciIsTecrubeleri.firmaAdi}">
                    <f:facet name="header">Firma adi</f:facet>
                    <h:outputText value="#{_kullaniciIsTecrubeleri.firmaAdi}"/>
                </rich:column>
                <rich:column sortBy="#{_kullaniciIsTecrubeleri.iseBaslamaTarihi}">
                    <f:facet name="header">Ise baslama tarihi</f:facet>
                    <h:outputText value="#{_kullaniciIsTecrubeleri.iseBaslamaTarihi}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_kullaniciIsTecrubeleri.istenAyrilmaTarihi}">
                    <f:facet name="header">Isten ayrilma tarihi</f:facet>
                    <h:outputText value="#{_kullaniciIsTecrubeleri.istenAyrilmaTarihi}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{bolumHome.managed}" id="kullaniciIsTecrubeleris">
        <div class="actionButtons">
            <s:button id="addkullaniciIsTecrubeleri"
                   value="Add kullaniciIsTecrubeleri"
                    view="/KullaniciIsTecrubeleriEdit.xhtml"
             propagation="none">
                 <f:param name="bolumId"
                         value="#{bolumHome.instance.id}"/>
                 <f:param name="kullaniciIsTecrubeleriFrom" value="Bolum"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
